﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:v="clr-namespace:ShredTheLog.Views;assembly=ShredTheLog.Views"
    xmlns:vm="clr-namespace:ShredTheLog.ViewModels;assembly=ShredTheLog.ViewModels"
    xmlns:cnv="clr-namespace:ShredTheLog.Converters;assembly=ShredTheLog.Converters"
    xmlns:c="clr-namespace:ShredTheLog.Controls;assembly=ShredTheLog.Controls"
    >

    <DataTemplate DataType="{x:Type vm:HomePageViewModel}">
        <Grid>
            <ListBox ItemsSource="{Binding Contacts}" SelectionMode="Single" IsTextSearchEnabled="True" IsTextSearchCaseSensitive="False" TextSearch.TextPath="Name">
                <ItemsControl.ItemContainerStyle>
                    <Style TargetType="{x:Type ListBoxItem}">
                        <Setter Property="ContextMenu">
                            <Setter.Value>
                                <ContextMenu c:Extensions.Items="{Binding Converter={x:Static vm:UserMenuItemsConverter.Default}}" DataContext="{Binding RelativeSource={RelativeSource Mode=Self}, Path=PlacementTarget.DataContext}"/>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ItemsControl.ItemContainerStyle>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <DockPanel>
                            <Grid>
                                <ContentPresenter DockPanel.Dock="Left" Content="{Binding Gender}"/>
                                <ContentPresenter DockPanel.Dock="Left" Content="{Binding Path=Uid, Converter={x:Static vm:OnlineStatusConverter.Default}}" Opacity="0.5"/>
                            </Grid>
                            <TextBlock Text="{Binding Name}" TextTrimming="CharacterEllipsis"/>
                        </DockPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ListBox>
        </Grid>
    </DataTemplate>
</ResourceDictionary>